#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
using namespace std;
class exchange_bai_ge
{
private:
	int Getbai(int a)
	{
		return (a / 100) % 10;
	}
	int Getshi(int a)
	{
		return (a / 10) % 10;
	}
	int Getge(int a)
	{
		return a % 10;
	}
public:
	int result(int a)
	{
		return Getge(a) * 100 + Getshi(a)*10 + Getbai(a);
	}
};
int main()
{
	int n;
	cin >> n;
	exchange_bai_ge example;
	cout << example.result(n) << endl;
}